package com.ywu.bpmn.flow.api;

import com.ywu.bpmn.flow.dto.YwuFlowDefinitionDto;
import com.ywu.bpmn.flow.service.YwuFlowDefinitionService;
import com.ywu.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName YwuFlowDefinitionApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/4/22 17:08
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/bpmn/flow")
public class YwuFlowDefinitionApi {
    @Autowired
    private YwuFlowDefinitionService service;

    /**
    * @Author GroundDemo
    * @Description 创建流程
    * @Date 17:13 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.flow.info")
    public CommonResult<Object> createFlowInfo(@RequestBody YwuFlowDefinitionDto dto) {
        return service.createFlowInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改流程元数据信息
    * @Date 17:39 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.flow.metadata.info")
    public CommonResult<Object> updateFlowMetaData(@RequestBody YwuFlowDefinitionDto dto) {
        return service.updateFlowMetaData(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改流程json信息
    * @Date 18:05 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.flow.json.info")
    public CommonResult<Object> updateFlowJson(@RequestBody YwuFlowDefinitionDto dto) {
        return service.updateFlowJson(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新流程表单信息
    * @Date 18:12 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.form.json.info")
    public CommonResult<Object> updateFormJson(@RequestBody YwuFlowDefinitionDto dto) {
        return service.updateFormJson(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除流程
    * @Date 18:23 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.flow.info")
    public CommonResult<Object> deleteFlowInfo(@RequestBody YwuFlowDefinitionDto dto) {
        return service.deleteFlowInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询流程信息
    * @Date 18:33 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.flow.page.list.info")
    public CommonResult<Object> queryFlowPageList(@RequestBody YwuFlowDefinitionDto dto) {
        return service.queryFlowPageList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 发布流程
    * @Date 18:27 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/publish.flow.info")
    public CommonResult<Object> publishFlowInfo(@RequestBody YwuFlowDefinitionDto dto) {
        return service.publishFlowInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询流程详情
    * @Date 21:36 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.flow.info")
    public CommonResult<Object> queryFlowInfo(@RequestBody YwuFlowDefinitionDto dto) {
        return service.queryFlowInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询流程表单内容
    * @Date 22:33 2025/4/22
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.flow.form.info")
    public CommonResult<Object> queryFlowFormInfo(@RequestBody YwuFlowDefinitionDto dto) {
        return service.queryFlowFormInfo(dto);
    }
}
